{$header}
<php>
	$order_id = getModelName($_REQUEST['id'],'order_detail','order_id'); 
	$order = M('Order');
	$order->getById($order_id);

	function getBuyId($orderdetail_id){
		$buyid = M('Buy')->where('order_detail_id = '.$orderdetail_id)->getField('id');
		return $buyid;
	}
</php>

<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">销售订单号<strong>{:$order->mano}</strong>打包操作[ <a href="__APP__/Shipping">返回发货列表</a> ] 
  </h3>
<div id="result" class="result none"></div>
<form class="form-horizontal well" method='post' id="form1" name="form1" action="__APP__/Shipping/insert/">
<table class="table table-bordered table-striped">
	<input type="hidden" name="order_id" value="{$order_id}" >
	<tr>
		<td>客户</td><td>{:getCustomerInfo($order->customer_id,'Customer')}</td>
		<td>地址</td><td> <textarea class="input-xxlarge" rows="5">{:$order->address}</textarea> </td>
	</tr>
	<tr>
		<td>包装信息</td><td colspan="3"> <textarea name="pack_info" class="span7" rows=3></textarea> </td>
	</tr>
	<tr>
		<td>备注</td><td colspan="3"> <textarea name="remark" class="span7" rows=3></textarea> </td>
	</tr>
	<tr>
		<td>经办人</td>
		<td>{:modList('User')}
			<input type="hidden" name="status" value="0">
		</td>
		
	</tr>
</table>
<php>
	$product = M('Product');
	
</php>
<h3 class="heading">包装明细 
	<div class="input-append">
                <input id="q" name="q" class="input-xlarge search-query" placeholder="搜索"><input id="hz" name="hz_id" type="hidden">
                <button class="btn" type="button" onclick="search('{:getModelName($order->customer_id,'Customer')}')"><i class="icon-search"></i>搜索并添加订单</button>
                <span class="help-inline alert">支持空格查询</span>
            </div>
</h3>
		<table class="table table-bordered table-striped" id="new_detail">
			<tr><th>销售分单号</th><th>产品名称</th><th>CAS</th><th>规格</th><th>数量</th><th>单位</th><th>小计</th><th>运费</th><th>总计</th>
			<th>移除</th> </tr>
			<volist name="vo" id="ca">
				<php> $product->getById($ca['product_id']);</php>
				<tr>
					<input type="hidden" name="product_id[]" value="{$ca.product_id}" >
					<input type="hidden" name="order_detail_id[]" value="{$ca.id}" >
				<td>{$ca.mano}</td>
				<td>{:$product->name};{:$product->ename}</td>
				<td>{:$product->cas}</td>
				<td>{$ca.specification|getModelName='Specification'}</td>
				<td><input type="hidden" name="price[]" value="{$ca.price}">
					<input type="text" name="number[]" value="{$ca.number}" class="span2">库存：{:getStock($ca['product_id'],$ca['specification'])} </td>
				<td>{$ca.unit_id|getModelName='Unit'}</td>
				<td><input type="hidden" name="total[]" class="span1" value="{$ca.total}">{$ca.total}{$ca.order_id|getModelName='Order','currency'|getConfigVal='currency'}</td>
				<td><input type="hidden" name="logifee[]"  value="{$ca.logifee}"> {$ca.logifee}</td>
				<td><input type="hidden" name="sum_total[]" class="span1" value="{$ca.should_pay} ">{$ca.should_pay} {$ca.order_id|getModelName='Order','currency'|getConfigVal='currency'}</td>
				
				<td class="span1"><img src="__PUBLIC__/Images/publish_x.png" alt="删除" onclick="removerow(this);"></td>
				</tr>
			</volist>
			
		</table>
	
<h3 class="heading">包装详情</h3>
	<table class="table table-bordered table-striped">
		<tr><th>包装编号</th><th>包装类型</th><th>毛重(KG)</th><th>长(CM)</th><th> 宽(CM)</th><th>高(CM)</th>
			<th>标签内容</th><th>粗略重量</th>
		</tr>
		<tr><td>1</td>
			<td> {:configList(C('packtype'),-1,'pack_type[]' )} </td>
			<td> <input type="text" name="pack_weight[]" value="" class="span1">  </td>
			<td><input type="text" name="length[]" value="" class="span1"></td>
			<td><input type="text" name="width[]" value="" class="span1"> </td>
			<td> <input type="text" name="height[]" value="" class="span1">  </td>
			<td><input type="text" name="pack_desc[]" class="span4" value=""></td>
			<td><input type="text" name="about_net_weight[]" class="span1" value=""></td>
			
		</tr>
		<tr><td>2</td>
			<td> {:configList(C('packtype'),-1,'pack_type[]' )} </td>
			<td> <input type="text" name="pack_weight[]" value="" class="span1">  </td>
			<td><input type="text" name="length[]" value="" class="span1"></td>
			<td><input type="text" name="width[]" value="" class="span1"> </td>
			<td> <input type="text" name="height[]" value="" class="span1">  </td>
			<td><input type="text" name="pack_desc[]" class="span4" value=""></td>
			<td><input type="text" name="about_net_weight[]" class="span1" value=""></td>
			
		</tr>
		<tr><td>3</td>
			<td> {:configList(C('packtype'),-1,'pack_type[]' )} </td>
			<td> <input type="text" name="pack_weight[]" value="" class="span1">  </td>
			<td><input type="text" name="length[]" value="" class="span1"></td>
			<td><input type="text" name="width[]" value="" class="span1"> </td>
			<td> <input type="text" name="height[]" value="" class="span1">  </td>
			<td><input type="text" name="pack_desc[]" class="span4" value=""></td>
			<td><input type="text" name="about_net_weight[]" class="span1" value=""></td>
			
		</tr>
		<tr><td>4</td>
			<td> {:configList(C('packtype'),-1,'pack_type[]' )} </td>
			<td> <input type="text" name="pack_weight[]" value="" class="span1">  </td>
			<td><input type="text" name="length[]" value="" class="span1"></td>
			<td><input type="text" name="width[]" value="" class="span1"> </td>
			<td> <input type="text" name="height[]" value="" class="span1">  </td>
			<td><input type="text" name="pack_desc[]" class="span4" value=""></td>
			<td><input type="text" name="about_net_weight[]" class="span1" value=""></td>
			
		</tr>
		<tr><td>5</td>
			<td> {:configList(C('packtype'),-1,'pack_type[]' )} </td>
			<td> <input type="text" name="pack_weight[]" value="" class="span1">  </td>
			<td><input type="text" name="length[]" value="" class="span1"></td>
			<td><input type="text" name="width[]" value="" class="span1"> </td>
			<td> <input type="text" name="height[]" value="" class="span1">  </td>
			<td><input type="text" name="pack_desc[]" class="span4" value=""></td>
			<td><input type="text" name="about_net_weight[]" class="span1" value=""></td>
			
		</tr>
		<tr><td>6</td>
			<td> {:configList(C('packtype'),-1,'pack_type[]' )} </td>
			<td> <input type="text" name="pack_weight[]" value="" class="span1">  </td>
			<td><input type="text" name="length[]" value="" class="span1"></td>
			<td><input type="text" name="width[]" value="" class="span1"> </td>
			<td> <input type="text" name="height[]" value="" class="span1">  </td>
			<td><input type="text" name="pack_desc[]" class="span4" value=""></td>
			<td><input type="text" name="about_net_weight[]" class="span1" value=""></td>
			
		</tr>
		<tr><td>7</td>
			<td> {:configList(C('packtype'),-1,'pack_type[]' )} </td>
			<td> <input type="text" name="pack_weight[]" value="" class="span1">  </td>
			<td><input type="text" name="length[]" value="" class="span1"></td>
			<td><input type="text" name="width[]" value="" class="span1"> </td>
			<td> <input type="text" name="height[]" value="" class="span1">  </td>
			<td><input type="text" name="pack_desc[]" class="span4" value=""></td>
			<td><input type="text" name="about_net_weight[]" class="span1" value=""></td>
			
		</tr>
		<tr>
				<td></td>
				<td colspan=5>
					<button type="submit" class="btn btn-primary"> <i class="icon-ok icon-white"></i>
						初步打包
					</button>
					<a class="btn btn-primary offset1" href="__URL__"> <i class="icon-arrow-left icon-white"></i>
						返回
					</a>
				</td>
			</tr>
	</table>
	</form>
</div>
<include file="Public:footer" />
<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/filter-product.js"></script>
<!--仓库操作中，仅当前客户-->
<script type="text/javascript">
    function search(customer){ 
        if ($('#q').val() != "") { 
            window.open(APP+'/Toshipping/search?form=form1&field=q&dstatus=4&keywords='+$('#q').val()+'&customer='+customer,'selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=yes,width=1000,height=800,top=100,left=120,scrollbars=yes');
        }else
            window.open(APP+'/Toshipping/search?form=form1&field=q&&dstatus=4&customer='+customer,'selected','directorys=no,toolbar=no,status=no,menubar=no,resizable=yes,width=1000,height=800,top=100,left=120,scrollbars=yes');
    }


function add_detail(input_type,trans_type){
        var order_detail_id = $('input[name="'+input_type+'_id"]').attr('value');
        if(order_detail_id > 0){
        jQuery.post(
        URL+'/getOrderDetail',
        {   order_detail_id:order_detail_id,
            trans_type:trans_type
        },
        function(data){
            data = data.data;
            $('#new_detail').append(data.product_detail);
        },
        'json'
        );
        }
 }

 </script>
